import { StratumAlgorithms } from '../../algorithms/cave/stratum';

/**
 * 安全岩盘厚度计算服务类，封装安全岩盘厚度相关计算功能
 */
export class StratumService {
  /**
   * 顶部安全岩盘厚度计算
   * @param params 计算参数
   * @returns 计算结果
   */
  static async calculateThicknessRockStratumTop(params: any) {
    try {
      const { gamma_m, l, sigma_t, tau, q, k_s } = params;
      const result = StratumAlgorithms.thicknessRockStratumTop(gamma_m, l, sigma_t, tau, q, k_s);
      return { success: true, data: result };
    } catch (error: any) {
      return { success: false, error: error.message };
    }
  }

  /**
   * 底部安全岩盘厚度计算
   * @param params 计算参数
   * @returns 计算结果
   */
  static async calculateThicknessRockStratumBottom(params: any) {
    try {
      const { gamma_m, l, sigma_t, tau, q, k_s } = params;
      const result = StratumAlgorithms.thicknessRockStratumBottom(gamma_m, l, sigma_t, tau, q, k_s);
      return { success: true, data: result };
    } catch (error: any) {
      return { success: false, error: error.message };
    }
  }

  /**
   * 侧部安全岩盘厚度计算
   * @param params 计算参数
   * @returns 计算结果
   */
  static async calculateThicknessRockStratumSide(params: any) {
    try {
      const { k_s, l, sigma_t, tau, k_af, gamma_f, h, p, gamma_w } = params;
      const result = StratumAlgorithms.thicknessRockStratumSide(k_s, l, sigma_t, tau, k_af, gamma_f, h, p, gamma_w);
      return { success: true, data: result };
    } catch (error: any) {
      return { success: false, error: error.message };
    }
  }
}